﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using FisheryPlatform.Bussiness.ShareCode;

namespace FisheryPlatform.Bussiness.WebRuntime
{
    public class AjaxShareCodeHandler : HttpHandlerBase, IHttpHandler
    {
        #region IHttpHandler 成员

        public bool IsReusable
        {
            get { return false; }
        }

        public void ProcessRequest(HttpContext context)
        {
            base.Init(context);

            var classId = long.Parse(FormValue("classId"));
            var parentId = long.Parse(FormValue("parentId"));
            if (Request.Url.Host.ToLower().IndexOf("admin.") == 0)
            {//后台实时
                base.SerializeDataToResponseStream(ShareCodeManager.GetShareCodeListByClassIdAndPId(classId, parentId));
            }
            else
            {
                base.SerializeDataToResponseStream(DataDictionary.Instance.GetChildShareCodeList((DataClassEnum)classId, parentId));
            }
        }

        #endregion
    }
}
